<?php
require 'SafeSQL.class.php';
include 'conn.php';

function dbOperate($queryStr, $param) {
    // global $mysql_server_name, $mysql_username, $mysql_password, $mysql_database;
    $link = mysql_connect(MYSQL_SERVER_NAME, MYSQL_USERNAME, MYSQL_PASSWORD) or die('Cannot connect to the DB'  + MYSQL_SERVER_NAME);
    mysql_query("SET NAMES 'UTF8'");  //For mutil_language display
    mysql_select_db(MYSQL_DATABASE, $link) or die('Cannot select the DB ');
    $safesql = new SafeSQL_MySQL;
    $query = '';
    if(!$param) $query = $queryStr;
    else $query = $safesql->query($queryStr, $param);
    // echo $query;
    $result = mysql_query($query, $link) or die('Error query:  '.$query);
    // echo $result;
    @mysql_close($link);
    return $result;
}


?>